<style type="text/css">
    .configDetail {
        margin: 20px;
    }

    .configproperty span {
        display: inline-block;
        width: 200px;
    }
</style>
<script type="text/javascript">
    LC.initToolbar({
        'new': LC.S.tools.toolNew,
        'cancel': LC.S.tools.toolCannel
    });
    $(document).ready(function (e) {
        LC.S.edit('.configDetail .edit', LC.S.serviceUrl, '${config._id}');
    });
    var configid = '${config._id}';
    ;
    function configpropertydelete(_this, p) {
        var configname = $(_this).parent().prev().text();
        if (!confirm('确定删除此属性吗？')) {
            return;
        }
        $.getJSON('system/config!propertyDelete.action', {id: configid, property: p}, function (rs) {
            if (rs.code == '1') {
                $(_this).parent().parent().remove();
            } else {
                alert(rs.msg);
            }
        });
    }
    function configpropertyadd() {
        if (checkForm($('.configproperty .add *[name]'))) {
            var data = serializeArray($('.configproperty *[name]'));
            data.id = configid;
            $.ajax({
                url: 'system/config!propertyAdd.action',
                type: 'POST',
                data: data,
                dataType: "JSON",
                success: function (rs) {
                    if (rs.code == '1') {
                        goPage('system/config!detail.action?id=' + configid, '#main')
                    } else {
                        alert(rs.msg);
                    }
                }
            });
        }
    }
</script>
<div class="configDetail">
    <div class="group">
        <div class="label">编　号：</div>
        <div class="value"><span>${config._id}</span></div>
    </div>
    <div class="group">
        <div class="label">名　称：</div>
        <div class="value"><span class="edit" type="text" regx="${check.name}" name="NAME">${config.name}</span>
        </div>
    </div>
    <div class="group">
        <div class="label">标　识：</div>
        <div class="value"><span class="edit" type="text" regx="${check.key}" name="KEY">${config.key}</span>
        </div>
    </div>
    <div class="group">
        <div class="label">描　述：</div>
        <div class="value">
            <span class="edit" type="textarea" name="DESCRIPT" nullable>${config.descript}</span></div>
    </div>
    <table class="configproperty">
        <tr>
            <th>属性</th>
            <th>值</th>
            <th>操作</th>
        </tr>
    <#--    <#assign cokey=config.option?keys/>
        <#list cokey as key>
        <tr>
          <th>${key}</th>
          <td><span type="text" regx="${check.value}" name="value" id="${config._id}">${config.option[key]}</span></td>
          <td><button onClick="configpropertydelete(this,'${key}')">删除</button></td>
        </tr>
        </#list>-->
        <tr class="add">
            <th><input type="text" name="property" regx="${check.property}"/></th>
            <td><input type="text" regx="${check.value}" name="value"/></td>
            <td>
                <button onClick="configpropertyadd()">添加</button>
            </td>
        </tr>
    </table>
</div>